$(function() {  
	$('table th input:checkbox').on('click' , function(){
		var that = this;
		$(this).closest('table').find('tr > td:first-child input:checkbox')
		.each(function(){
			this.checked = that.checked;
			$(this).closest('tr').toggleClass('selected');
		});
			
	});
});

var checkAll = {
  isChecked:function(){
	  var $chkarry = $('input:checked').not($('#checkedAll'));
	  if( $chkarry != null && $chkarry.length > 0){
		  return true;
	  }else{
		  return false;
	  }
  },
  getIdsAsArr:function(){
	  var $chkarry = $('input:checked').not($('#checkedAll'));
	  var params = new Array();
	  for(var i=0;i<$chkarry.length;i++){
		  params.push( $chkarry[i].value );
	  }
	  return params;
  },
  getIdsAsStr:function(){
	  var $chkarry = $('input:checked').not($('#checkedAll'));
	  var params = '';
	  for(var i=0;i<$chkarry.length;i++){
		  params += $chkarry[i].value + ",";
	  }
	  params = params.substring(0,params.length - 1);
	  return params;
  }
}